1、浏览器访问gitlab,web界面直接返回The change you wanted was rejected或者查看/var/log/gitlab/gitlab-rails下面的production.log提示Can’t verify CSRF token authenticity Completed 422 Unprocessable:


出现该问题,一般都是前端nginx的代理报头配置出现了问题,下面是分别在https和http不同情况下的解决方法
2、如果在/etc/gitlab/gitlab.rb下的参数external_url “https://***”配置有https,访问遇到422错误,修改/etc/gitlab/gitlab.rb下nginx配置,添加以下配置信息:
1 2 3 4
| nginx['proxy_set_headers'] = { "X-Forwarded-Proto" => "https", "X-Forwarded-Ssl" => "on" }
|
之后重新编译gitlab,命令如下:
3、如果在/etc/gitlab/gitlab.rb下的参数external_url “http://***”配置有http,访问遇到422错误,修改/etc/gitlab/gitlab.rb下nginx配置,添加以下配置信息:
1 2 3 4
| nginx['proxy_set_headers'] = { "X-Forwarded-Proto" => "http", "CUSTOM_HEADER" => "VALUE" }
|
之后重新编译gitlab,命令如下:
4、参考链接
gitlab关于nginx配置的官网链接